//
//  MLAAboutUsVC.m
//  MagicLampApp
//
//  Created by Zheng on 2018/12/19.
//  Copyright © 2018 zheng.magic.lamp.app. All rights reserved.
//

#import "MLAAboutUsVC.h"
#import "MLAAboutUsModel.h"

@interface MLAAboutUsVC ()

@end

@implementation MLAAboutUsVC {
    UILabel *titleLbl;
    UILabel *timeLbl;
    UILabel *contentLbl;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self configTitle:@"关于我们"];
    
    [self loadData];
}


- (void)loadData {
    [MLAHttpManage postHostType:MLAHttpHostType_Api api:kAboutUs params:nil success:^(id  _Nonnull response, NSString * _Nonnull msg) {
        MLAAboutUsModel *model = [MLAAboutUsModel mj_objectWithKeyValues:response];
        [self configSubviewWithModel:model];
    } failure:^{
        
    }];
}


- (void)configSubviewWithModel:(MLAAboutUsModel *)model {
    UILabel *titleLbl = [[UILabel alloc] init];
    titleLbl.font = CX_GetNormalFont(18);
    titleLbl.textColor = CX_GetColorTitle();
    titleLbl.text = model.title;
    [self.view addSubview:titleLbl];
    [titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.equalTo(self.titleView.mas_bottom).offset(20);
    }];
    
    UILabel *timeLbl = [[UILabel alloc] init];
    timeLbl.font = CX_GetNormalFont(10);
    timeLbl.textColor = CX_GetColorHex(0x999999, 1);
    timeLbl.text = model.ctime;
    [self.view addSubview:timeLbl];
    [timeLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.equalTo(titleLbl.mas_bottom).offset(10);
    }];
    
    UILabel *detailLbl = [[UILabel alloc] init];
    detailLbl.frame = CGRectMake(0, 0, CX_GetScreenWidth()-30, 0);
    detailLbl.font = CX_GetNormalFont(12);
    detailLbl.textColor = CX_GetColorHex(0x6B7178, 1);
    detailLbl.numberOfLines = 0;
    detailLbl.text = model.content;
    [detailLbl sizeToFit];
    [self.view addSubview:detailLbl];
    [detailLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.top.equalTo(timeLbl.mas_bottom).offset(20);
        make.height.mas_equalTo(CGRectGetHeight(detailLbl.frame));
    }];

}

@end
